import { Column, Entity, Index, PrimaryGeneratedColumn } from 'typeorm';

@Index('idx_parent_id', ['parentId'], {})
@Index('idx_ifpub', ['ifpub'], {})
@Index('idx_channel_id', ['channelId'], {})
@Entity('rrz_article_nodes', { schema: 'rrzcms' })
export class RrzArticleNodes {
  @PrimaryGeneratedColumn({
    type: 'int',
    name: 'id',
    comment: '表id',
    unsigned: true,
  })
  id: number;

  @Column('int', {
    name: 'channel_id',
    comment: '所属模型id',
    unsigned: true,
    default: () => "'0'",
  })
  channelId: number;

  @Column('varchar', { name: 'name', comment: '栏目名称', length: 255 })
  name: string;

  @Column('varchar', { name: 'en_title', comment: '栏目英文名称', length: 255 })
  enTitle: string;

  @Column('varchar', {
    name: 'dir_name',
    nullable: true,
    comment: '目录英文名',
    length: 255,
  })
  dirName: string | null;

  @Column('mediumint', {
    name: 'parent_id',
    comment: '父级ID',
    unsigned: true,
    default: () => "'0'",
  })
  parentId: number;

  @Column('varchar', {
    name: 'img',
    nullable: true,
    comment: '栏目图片',
    length: 255,
  })
  img: string | null;

  @Column('varchar', { name: 'id_path', comment: 'id路径', length: 255 })
  idPath: string;

  @Column('tinyint', {
    name: 'depth',
    comment: '栏目深度',
    unsigned: true,
    default: () => "'0'",
  })
  depth: number;

  @Column('smallint', {
    name: 'sort',
    nullable: true,
    comment: '排序',
    unsigned: true,
    default: () => "'50'",
  })
  sort: number | null;

  @Column('varchar', { name: 'path', comment: '栏目路径', length: 255 })
  path: string;

  @Column('varchar', {
    name: 'tmpl_path',
    nullable: true,
    comment: '模板',
    length: 100,
  })
  tmplPath: string | null;

  @Column('varchar', {
    name: 'tmpl_view',
    nullable: true,
    comment: '文档模板',
    length: 100,
  })
  tmplView: string | null;

  @Column('varchar', {
    name: 'view_route',
    comment: '详情页路由',
    length: 255,
    default: () => "'{typedir}/{aid}.html'",
  })
  viewRoute: string;

  @Column('varchar', {
    name: 'list_route',
    comment: '列表页路由',
    length: 255,
    default: () => "'{typedir}/list_{tid}_{page}.html'",
  })
  listRoute: string;

  @Column('varchar', {
    name: 'seo_title',
    nullable: true,
    comment: 'SEO标题',
    length: 255,
  })
  seoTitle: string | null;

  @Column('mediumtext', {
    name: 'seo_description',
    nullable: true,
    comment: '分类描述',
  })
  seoDescription: string | null;

  @Column('varchar', {
    name: 'seo_keywords',
    nullable: true,
    comment: '搜索关键词',
    length: 200,
  })
  seoKeywords: string | null;

  @Column('longtext', { name: 'content', nullable: true, comment: '文章内容' })
  content: string | null;

  @Column('longtext', {
    name: 'wap_content',
    nullable: true,
    comment: '手机端内容',
  })
  wapContent: string | null;

  @Column('enum', {
    name: 'ifpub',
    comment: '发布',
    enum: ['true', 'false'],
    default: () => "'true'",
  })
  ifpub: 'true' | 'false';

  @Column('int', {
    name: 'uptime',
    nullable: true,
    comment: '修改时间',
    unsigned: true,
  })
  uptime: number | null;
}
